package lab01;

import java.util.Scanner;

public class Test08 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int number = (int) (Math.random() * 100) + 1;
        int i = 0;

        while (true) {

            i++;
            System.out.println("enter a number");
            int num = sc.nextInt();

            if (num == number) {
                System.out.println("猜对了！");
                System.out.println("the time:" + i + "," + "the num is:" + number);
                break;
            }

            if (num > number) {
                System.out.println("猜大了！");
            }

            if (num < number) {
                System.out.println("猜小了！");
            }

        }
    }
}
